Stability conditions of floating bodies in hydrostatics